import "dotenv/config";

function isYes(v: string | undefined): boolean {
  return ["1", "y", "Y", "yes", "Yes", "YES", "t", "T", "true", "True", "TRUE"].includes(v || "");
}

// prettier-ignore
const env = {
  auth: {
    tokenExpireDays: +(process.env.AUTH_TOKEN_EXPIRE_DAYS || "7"),
    tokenIssuer:       process.env.AUTH_TOKEN_ISSUER || "urn:paimon-is-cute",
    hs512Secret:       process.env.AUTH_HS512_SECRET || "5Cxuyb3LL/md/XV4hDerlRTpGfCoEZ3h+ne3LCCwBumXE37M0KamatRoHU1X6vCYbxyQA1qC7pTNIQTzlw/iLQ==",
  },
  server: {
    cookie: {
      secure: isYes(process.env.SERVER_COOKIE_SECURE)
    }
  }
};

export default env;
